<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<input type="hidden" name="zh_parsen/fzr_name" value="<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/zh_name"/>"/>
<input type="hidden" name="zh_parsen/fzr_mobile" value="<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/mobile"/>"/>
<input type="hidden" name="zh_parsen/fzr_tel" value="<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/tel_work"/>"/>
<input type="hidden" name="zh_parsen/fzr_email" value="<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/email"/>"/>

<div class="t_bar">
        <span class="color_red">*</span>创业导师名单
    </div>
    <table  id="eq_table2" cellpadding="0" class="t_css table01" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
	    <thead >
	     <tr style="border:1px solid #B7D1E6">
	         <th class="TblHead" align="center" style="width: 5%">选择</th>
	         <th class="TblHead" align="center" style="width: 5%">序号</th>
	         <th class="TblHead" align="center" style="width: 13%">导师姓名</th>
	         <th class="TblHead" align="center" style="width: 5%">性别</th>
	         <th class="TblHead" align="center" style="width: 5%">年龄</th>
	         <th class="TblHead" align="center" style="width: 17%">工作单位</th>
	         <th class="TblHead" align="center" style="width: 13%">职务</th>
	         <th class="TblHead" align="center" style="width: 20%">当年开展服务情况</th>
	         <th class="TblHead" align="center" style="width: 13%">联系方式</th>
	     </tr>
	    </thead>
	    <tbody id="tab">
	        <tr style="display:none;">
	            <td align="center">
	                <input type="radio" style="border: 0px;background-color: white;" class="radiobutton" name="selMileStones" >
	            </td>
	            <td align="center">
	                <span name="tutor_persons|tutor_person[0]@seq_no" >[index]</span> 
	            </td>
	            <td align="center">
	                <input name="tutor_persons|tutor_person[0]|basic_info|name" style="width: 80%" label="导师姓名" type="text" required class="input_text required" value="" maxlength="20"/>
	            </td>
	            <td align="center">
	    <cpt:select id="gender_two_[index]" key="gender"  className="input_css" name="gender2"
	                onChange="initControlValue(this.id);" value="" style="width:40px;border: 1px solid #A1C0DC;"></cpt:select>
	    <input type="hidden" name="tutor_persons|tutor_person[0]|basic_info|gender2_value" value="" class="input_text required" label="性别"/>
	    <input type="hidden" name="tutor_persons|tutor_person[0]|basic_info|gender2_name" value="" />
	            </td>
	            <td align="center">
	                <input name="tutor_persons|tutor_person[0]|basic_info|age" style="width: 60%;text-align:right;" label="年龄" type="text" required class="input_text required" onfocus="InitInput.setNumber(this,3,0,0)" value=""/>
	            </td>
	            <td align="center">
	                <input name="tutor_persons|tutor_person[0]|basic_info|work_unit" style="width: 80%" label="工作单位" type="text" required class="input_text required" value="" maxlength="50"/>
	            </td>
	            <td align="center">
	                <input name="tutor_persons|tutor_person[0]|basic_info|job" style="width: 80%" label="职务" type="text" required class="input_text required" value="" maxlength="20"/>
	            </td>
	            <td align="center">
	                <input name="tutor_persons|tutor_person[0]|basic_info|lyear_service_development" style="width: 80%" label="当年开展服务情况" type="text" required class="input_text required" value="" maxlength="100"/>
	            </td>
	            <td align="center">
	                <input name="tutor_persons|tutor_person[0]|basic_info|contact_way" style="width: 80%" label="联系方式" type="text" required class="input_text required" value="" maxlength="50"/>
	            </td>
	        </tr>
	        
	        
	        <c:set value="0" var="index" scope="page"/>
	        <x:forEach select="$xmlData/data/tutor_persons/tutor_person" var="tutor_person">
		        <c:choose>
		            <c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
		            <c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
		        </c:choose>
		        <tr >
		            <td align="center">
		                <input type="radio" style="border: 0px;background-color: white;" class="radiobutton" name="selMileStones" >
		            </td>
		            <td align="center">
		                <span name="tutor_persons/tutor_person[${flag}${index}]@seq_no"><x:out select="$tutor_person/@seq_no"/></span> 
		            </td>
		            
		            <td align="center">
		                <input name="tutor_persons/tutor_person[${flag}${index}]/basic_info/name" label="导师姓名" style="width: 80%" type="text" required class="input_text required" value="<x:out select="$tutor_person/basic_info/name"/>" maxlength="20"/>
		            </td>
		            <td align="center">
		                <c:set var="gender2"><x:out select="$tutor_person/basic_info/gender2_value" /></c:set>
		                <cpt:select id="gender_two_${index}" key="gender" className="input_css" name="gender2"
		                            onChange="initControlValue(this.id);" value="${gender2 }" style="width:40px;border: 1px solid #A1C0DC;"></cpt:select>
		                <input type="hidden" name="tutor_persons/tutor_person[${flag}${index}]/basic_info/gender2_value" value="${gender2 }" class="input_text required" label="性别"/>
		                <input type="hidden" name="tutor_persons/tutor_person[${flag}${index}]/basic_info/gender2_name" value="<x:out select="$tutor_person/basic_info/gender2_name" />" />
		            </td>
		            <td align="center">
		                <input name="tutor_persons/tutor_person[${flag}${index}]/basic_info/age" label="年龄" style="width: 60%;text-align:right;" type="text" required class="input_text required" onfocus="InitInput.setNumber(this,3,0,0)" value="<x:out select="$tutor_person/basic_info/age"/>"/>
		            </td>
		            <td align="center">
		                <input name="tutor_persons/tutor_person[${flag}${index}]/basic_info/work_unit" label="工作单位" style="width: 80%" type="text" required class="input_text required" value="<x:out select="$tutor_person/basic_info/work_unit"/>" maxlength="50"/>
		            </td>
		            <td align="center">
		                <input name="tutor_persons/tutor_person[${flag}${index}]/basic_info/job" label="职务" style="width: 80%" type="text" required class="input_text required" value="<x:out select="$tutor_person/basic_info/job"/>" maxlength="20"/>
		            </td>
		            <td align="center">
		                <input name="tutor_persons/tutor_person[${flag}${index}]/basic_info/lyear_service_development" label="当年开展服务情况" style="width: 80%" type="text" required class="input_text required" value="<x:out select="$tutor_person/basic_info/lyear_service_development"/>" maxlength="100"/>
		            </td>
		            <td align="center">
		                <input name="tutor_persons/tutor_person[${flag}${index}]/basic_info/contact_way" label="联系方式" style="width: 80%" type="text" required class="input_text required" value="<x:out select="$tutor_person/basic_info/contact_way"/>" maxlength="50"/>
		            </td>
		        </tr>
		        <c:set value="${index+1}" var="index" scope="page"/>
		        <script type="text/javascript">
		            showAllDateTag("eq_table2");
		        </script>
	        </x:forEach>
	    </tbody>
	</table>
    <table width="98%" align="center">
            <tr >
                <td>
                    <input class="button_02" name="cmdAddbefore" type=button value="添加" onclick="if(checkTabLimit('eq_table2',999,'创业导师名单内容最多只能填写999条')){addNewRow('eq_table2');showDateTag('eq_table2');}try{top.resizeFrame();}catch(e){};">
                    <input class="button_02" name="cmdMovePrev" type=button value="上移" onclick="movePrev('eq_table2','selMileStones');">
                    <input class="button_02" name="cmdMoveNext" type=button value="下移" onclick="moveNext('eq_table2','selMileStones');">
                    <input class="button_02" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('eq_table2','创业导师名单');">
                </td>
            </tr>
    </table>
<script>
function initControlValue(objId){
    
    var name="";
    var obj=$("#"+objId);
    if(obj.is("select")){
        name=obj.attr("name");
        obj.parent().children("input[name$='"+name+"_value'][type='hidden']").val($("#"+objId).find("option:selected").val());
        $("#"+objId).parent().children("input[name$='"+name+"_name']").val($("#"+objId).find("option:selected").text());
    }
   
    else if(obj.is(":radio")){
        name=obj.attr("name");
        if(obj.is(":checked")){//如果被选中
            //alert($("#"+objId).val());        
            obj.parents("table").find("input[name$='"+name+"_value'][type='hidden']").val($("#"+objId).val());
            $("#"+objId).parent().children("input[name$='"+name+"_name']").val($("#"+objId).next().text());
        }
        else{
            
            obj.parents("table").find("input[name$='"+name+"_value'][type='hidden']").val("");
        }
    }else if(obj.is(":checkbox")){
        name=obj.attr("name");
        if(obj.is(":checked"))//如果被选中
            obj.parent().find("input[name$='"+name+"_value'][type='hidden']").val($("#"+objId).val());
        else
            obj.parent().find("input[name$='"+name+"_value'][type='hidden']").val("");
    }else{
        name=obj.attr("id");
        obj.parents("td").find("input[name$='"+name+"_name'][type='hidden']").val(obj.val());
        obj.parents("td").find("input[name$='"+name+"_code'][type='hidden']").val($("#"+objId+"_hideId").val());
    }   
}
</script>